﻿using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Collections.ObjectModel;

namespace HigLabo.Net.WindowsLive
{
    /// <summary>
    /// 
    /// </summary>
    public class AppUriCollection : Collection<AppUri>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsontext"></param>
        public AppUriCollection(String jsontext)
        {
            this.SetProperty(jsontext);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsontext"></param>
        public void SetProperty(String jsontext)
        {
            var cc = JsonConvert.DeserializeObject(jsontext) as JContainer;

            foreach (var s in WindowsLiveClient.CreateJsonTextList(cc))
            {
                this.Add(new AppUri(s));
            }
        }
    }
}
